<link rel="stylesheet" type="text/css" href="<?php HTMLHelper::baseUrl() ?>css/admin.css" />
<div class="admin_back">
    <div class="admin_area">
    <h3>Administración de Usuarios</h3>
    <div class="commands"><a href="<?php HTMLHelper::baseUrl() ?>users/create">Nuevo usuario</a></div>
    <div class="paginador">Página: <?php echo PageHelper::select($page, $lastPage); ?></div>
    <table class="listado">
      <tr><td>NOMBRE</td><td>EMAIL</td><td colspan="2" style="text-align: center;">TIPO</td><td></td></tr>
      <?php foreach($users as $user): ?>
      <tr>
        <td><a href="<?php HTMLHelper::baseUrl() ?>users/edit/page_<?php echo $page ?>/id_<?php echo $user['id'] ?>"><?php echo $user['name'] ?></a></td>
        <td><?php echo $user['email'] ?></td>
        <td><?php echo $user['editor']?"editor":"" ?></td>
        <td><?php echo $user['administrator']?"administrador":"" ?></td>
        <td><a href="<?php HTMLHelper::baseUrl() ?>users/delete/token_<?php echo $csrfToken ?>/page_<?php echo $page ?>/id_<?php echo $user['id'] ?>" onclick="return confirm('¿Esta seguro que desea borrar el usuario \'<?php echo $user['name']; ?>\'?');">borrar</a></td>
      </tr>
      <?php endforeach; ?>
    </table>
    <div class="paginador">Página: <?php echo PageHelper::select($page, $lastPage); ?></div>
    </div>
</div>
<div class="admin_links">
<?php AdminHelper::userBox(1); ?><br/><br/>
<h3>Secciones</h3>
<?php AdminHelper::links(1); ?>
</div>
<script>
  $(function(){
    $('.page_selector').change(function(){ top.location.href = "users/list/page_"+$(this).val(); });
  });
</script>